import java.io.*;
import java.util.ArrayList;
public class WriteHtml {
	
	String intestazione1="<!DOCTYPE html>\n"+
"<!--[if IE 7 ]><html class=\"ie ie7\" lang=\"en\"> <![endif]-->\n"+
"<!--[if IE 8 ]><html class=\"ie ie8\" lang=\"en\"> <![endif]-->\n"+
"<!--[if (gte IE 9)|!(IE)]><!--><html lang=\"en\" class=\"ie ie9\"> <!--<![endif]-->\n"+
"<head>\n"+
	
    "<meta charset=\"utf-8\">\n"+
    "<meta name=\"description\" content=\"\"/>\n"+
    "<meta name=\"keywords\" content=\"\"/>\n"+
    "<!-- Mobile Specific Metas\n"+
    "+++++++++++++++++++++++++++ -->\n"+
    "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">\n"+
    "<link rel=\"shortcut icon\" href=\"img/favico.ico\">\n"+
    "<link rel=\"apple-touch-icon\" href=\"img/apple_icons_57x57.png\">\n"+
    "<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"img/apple_icons_72x72.png\">\n"+
    "<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"img/apple_icons_114x114.png\">\n"+
    "<title>\n";
    String intestazione2="</title>\n"+
    "<link href=\'http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800,400italic,600italic,700italic' rel='stylesheet\' type=\'text/css\'>\n"+
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/bootstrap.css\">\n"+
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/bootstrap-responsive.css\">\n"+    
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/plugins.css\">\n"+
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/theme.css\">\n"+
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/responsive.css\">\n"+
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/theme_settings.css\">\n"+
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/skin.css\">\n"+
	"<link rel=\"stylesheet\" type=\"text/css\" href=\"css/color_theme.css\" id=\"theme_color\">\n"+
    "<!--[if IE 8 ]>\n"+
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/ie_css.css\">\n"+
    "<script>\n"+
       "var e = (\"article,aside,figcaption,figure,footer,header,hgroup,nav,section,time\").split(',');\n"+
        "for (var i = 0; i < e.length; i++) {\n"+
            "document.createElement(e[i]);\n"+
        "}\n"+		
    "</script>\n"+
    "<![endif]-->\n"+
	"<script src=\"http://code.jquery.com/jquery-1.9.1.min.js\"></script>\n"+
    "<script src=\"js/masonry.pkgd.min.js\"></script>\n"+
    "<script type=\"text/javascript\" language=\"JavaScript\" src=\"http://count.vivistats.com/laser.asp?CountId=61043\"></script>\n"+
    "<noscript>\n"+
	"<a href=\"http://it.vivistats.com/\"><img src=\"http://count.vivistats.com/laser.asp?CountId=61043&js=off\" border=\"0\" alt=\"contatore visite\"></a>"+
	"</noscript>\n"+
"</head>\n"+
"<body class=\"fullscreen_layout\">\n"+
"<? include(\"navbar.php\")?>"+
"<div class=\"fullscreen_block\">\n"+
"<div class=\"fs_grid_module\">\n";
	
	String footer=  "<div class=\"clear\"></div>\n"+
"    </div><!-- .fs_grid_module -->\n"+
"</div> <!-- .fullscreen_block -->   \n"+
"<div class=\"header2top\"></div>\n"+
"<!--<div class=\"header2top\"></div>-->\n"+
"<script>\n"+
"$(document).ready(function(){\n"+
"	});\n"+
"	$(window).load(function(){\n"+
		"//$('.fs_grid_module').masonry();\n"+
		"$('.fs_grid_module').masonry({\n"+
		"	itemSelector: '.grid_gallery-item',\n"+
		"	isAnimated: true\n"+
		"});\n"+
		"setTimeout(\"$('.fs_grid_module').masonry()\",500);\n"+
"});\n"+
"	$(window).resize(function(){\n"+
"		$('.fs_grid_module').masonry();\n"+
"	});\n"+
"</script>\n"+
"<script src=\"http://code.jquery.com/ui/1.10.2/jquery-ui.min.js\" type=\"text/javascript\"></script>\n"+
"<script type=\"text/javascript\" src=\"js/theme.js\"></script>	\n"+
"</body>\n"+
"</html>\n";
	public WriteHtml(){}
	
	public boolean writeHtml(String absPath,String fileHtml, String galleryName,String titolo,ArrayList<String> nomi)
	{
		try
	     {
	          FileOutputStream file = new FileOutputStream(absPath+fileHtml);
	          PrintStream scrivi = new PrintStream(file);
	          scrivi.println(intestazione1);
	          scrivi.println(titolo);
	          scrivi.println(intestazione2);
	          for(String n:nomi)
	          {
	                scrivi.println("<div class=\"grid_gallery-item\">\n"+
	                    	"<div class=\"item_hover\">"+
	                           " <div class=\"item_hover-img\">"+
	                                "<img src=\""+galleryName+"/thmb/"+n+"\" alt=\"\"/>"+
	                                "<div class=\"item_hover-fadder\"></div>"+
	                                "<a href=\""+galleryName+"/"+n+"\" rel=\"prettyPhoto[gallery1]\" class=\"prettyPhoto\"></a>"+
	                            "</div>\n"+
	                        "</div>\n"+
	                    "</div><!-- .grid_gallery-item -->\n");
	                		
	                
	                
	          }
	          scrivi.println(footer);
	          scrivi.close();
	          return true;
	      }
	      catch (IOException e)
	      {
	          System.out.println("Errore: " + e);
	          return false;
	      }
	}
	

}
